package com.overload;

import com.overload.entity.Human;
import com.overload.entity.Man;
import com.overload.entity.Woman;

/**
 * Party
 *
 * @author byc
 * @date 2022-02-04
 */
public class Party {

    public void playGame(Human human){
        human.playGame();
        System.out.println("human is playing Game");
    }

    public void play(Human human){
        System.out.println("人类在狂欢");
    }
    public void play(Man man){
        System.out.println("男人在狂欢");
    }
    public void play(Woman woman){
        System.out.println("女人在狂欢");
    }

    public static void main(String[] args) {

        //重载方法Test
        Party party = new Party();

        Human man = new Man();
        party.play(man);
        Human woman = new Woman();
        party.play(woman);

        System.out.println("----------------");

        party.play(new Man());
        party.play(new Woman());

        System.out.println("=================");
        //多态
        Human man1 = new Man();
        man1.playGame();

        System.out.println("~~~~~~~~~~~~~~~~~");

        party.playGame(man);
        party.playGame(woman);

        System.out.println("++++++++++++++++++");
        //匿名内部类
        party.playGame(new Human() {
            @Override
            public void playGame() {
                System.out.println("人妖在playing Game");
            }
        });
    }
}
